﻿@model IEnumerable<KRM.Core.vIncompletePhoneOrder>
@{
    ViewBag.Title = "Pending Phone Order";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="container-fluid">
    <div class="box">
        <div class="row-fluid">
            <fieldset>
                <legend>Search phone orders</legend>
                <form action="/orderview/pendingphoneorders">
                    <div class="row-fluid">
                        <div class="span2">
                            Postcode
                        </div>
                        <div class="span2">
                            <input type="text" class="input-block-level" name="postcode"/>
                        </div>
                        <div class="span2">Order number</div>
                        <div class="span2">
                            <input type="text" class="input-block-level" name="ordernumber"/>
                        </div>
                        <div class="span2">Email address</div>
                        <div class="span2">
                            <input type="email" class="input-block-level" name="email"/>
                        </div>
                    </div>
                    <div class="row-fluid">
                        <div class="span2">
                            Name
                        </div>
                        <div class="span2">
                            <input type="text" class="input-block-level" name="name"/>
                        </div>
                        <div class="span2">Phone number</div>
                        <div class="span2">
                            <input type="text" class="input-block-level" name="phonenumber"/>
                        </div>
                        
                        <div class="span4 text-right">
                            <input type="submit" value="Search" class="btn btn-primary"/>
                            <a href="/orderview/pendingphoneorders" class="btn btn-danger">Clear</a>
                        </div>
                    </div>
                </form>
            </fieldset>
            <div class="pendingphone-scroll fixhead">
                <table class="table table-bordered table-fix tbl-selected">
                    <thead>
                        <tr>
                            <th>TemporaryOrderID</th>
                            <th>StoreName</th>
                            <th>CompanyName</th>
                            <th>Name</th>
                            <th>EmailAddress</th>
                            <th>AddressLine1</th>
                            <th>OrderDate</th>
                            <th>Amount</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model)
                        {
                            <tr style="cursor: pointer" onclick="pendingphoneorderselected('@item.TemporaryID','@item.TempOrderID')">
                                <td>@item.TemporaryID</td>
                                <td>@item.StoreName</td>
                                <td>@item.CompanyName</td>
                                <td>@item.CusName</td>
                                <td>@item.EmailAddress</td>
                                <td>@item.AddressLine1</td>
                                <td>@item.DatePlaced</td>
                                <td>@item.OrderValue</td>
                            </tr>
                        }
                    </tbody>
                </table>

            </div>
            <div class="row-fluid">
                <div class="span3">
                    Number of Outstanding Orders: @Model.Count()
                </div>
                <div class="span3">
                    Total Value: @Model.Sum(c => c.OrderValue.Value).ToString("N2")
                </div>
                <div class="span6 text-right">
                    <input type="button" value="Confirm Order" class="btn btn-primary" id="btn-confirmorder" onclick="pendingphoneorderconfirm(0, 0)"/>
                    <input type="button" value="Cancel Order" class="btn btn-danger" id="btn-cancelorder" onclick="pendingphoneordercancel(0,0)"/>
                </div>
            </div>
        </div>
    </div>
</div>

